﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Top : System.Web.UI.UserControl
{
    private string _IsShowBar;
    public string IsShowBar
    {
        get { return _IsShowBar; }
        set { _IsShowBar = value; }
    }


    public string ToolbarStyle = "toolbar";

    private bool isFloat = false;
    public bool IsFloat 
    { 
        get{
            return isFloat;
        }
        set {
            isFloat = value;
            if (isFloat)
            {
                ToolbarStyle = "toolbarFloat";
            }
            else
            {
                ToolbarStyle = "toolbar";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Link/ico
        HtmlLink icoLink = new HtmlLink();
        icoLink.Href = "img/favicon.ico";
        icoLink.Attributes.Add("rel", "shortcut icon");
        Page.Header.Controls.Add(icoLink);

        bool IsShowToolbar =true;
        //标题
        lbl_title.Text = Page.Title;
        //是否隐藏导航栏
        if (!IsShowToolbar)
        {
            div_toolbar.Attributes.Add("style", "display:none;");
            Page.RegisterStartupScript("hiddin_padding", "<script>document.body.setAttribute('style', 'paddingTop:-46px');");
        }
        this.div_toolbar.Attributes["class"] = ToolbarStyle;
        if (isFloat)
        {
            Page.RegisterStartupScript("padding", "<script>document.body.style.paddingTop= '46px';</script>");
        }
    }
}
